#pragma once
#include "d3dutil.h"
#include "LevelElement.h"
#include "Vertex.h"
#include <vector>
//-----------------------------------------------------
// TrianglePosColor Class									
//-----------------------------------------------------
class TrianglePosColor : public LevelElement
{
public:
	TrianglePosColor();				// Constructor
	virtual ~TrianglePosColor();		// Destructor

	virtual void Initialize(ContentManager *pContentManager);
	virtual void Tick(const InputState & refInputState){}
	virtual void Draw(const RenderContext* pRenderContext);


private: 
	//-------------------------------------------------
	// Datamembers								
	//-------------------------------------------------
	ID3D10InputLayout*			m_pVertexLayout;
	ID3D10Buffer*				m_pVertexBuffer;

	ID3D10Effect*				m_pDefaultEffect;
	ID3D10EffectTechnique*		m_pDefaultTechnique;

	ID3D10EffectMatrixVariable* m_pWorldViewProjectionVariable;

	UINT m_VertexBufferStride;
	std::vector<VertexPosCol> m_ArrVertices;

	void CreateEffect(ContentManager *pContentManager);
	void GetEffectVariables(ID3D10Effect* pEffect);
	void DefineInputlayout();
	void BuildShape();
	void AddTriangle (VertexPosCol v1, VertexPosCol v2, VertexPosCol v3);
	void BuildVertexBuffer();

	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	TrianglePosColor(const TrianglePosColor& yRef);									
	TrianglePosColor& operator=(const TrianglePosColor& yRef);	
};

 
